<!-- inc:header -->
<div class="notice"><div class="p">
	<table width="100%" cellpadding="0" cellspacing="0">
	<tr>
		<td><span class="lead">
		&nbsp;&raquo; <a href="{:site_url('tpl')}">风格管理</a>
		&nbsp;&raquo; <a href="{:site_url('tpl,list')}id={:$id}">风格文件列表</a> <span class="red">{:$rs[title]}</span>
		<!-- $leader AS $key=>$value -->
		&nbsp;&raquo; <a href="{:$value[url]}">{:$value[subject]}</a>
		<!-- end -->
		&nbsp;&raquo; 编辑/添加信息
		</span></td>
	</tr>
	</table>
</div></div>

<form method="post" action="{:site_url('tpl,tpl_setok')}id={:$id}&parent={:rawurlencode($parent)}&filename={:$tplfile}" onsubmit="return chk();">
<div class="table">
	<div class="left"><span style="color:red;">*</span> 文件名：</div>
	<input type="text" name="tplfile" id="tplfile" value="{:$tplfile}">
	<span class="clue_on"> 请尽量不要改名，需要包含扩展名：<span class="red">{:$rs[ext]}</span> </span>
</div>
<div class="table">
	<div class="left"><span style="color:red;">*</span> 模板内容：</div>
	<div class="right"><textarea id="content" name="content" style="width:600px;height:350px;">{:$content}</textarea></div>
	<div class="clear"></div>
</div>


<div class="table">
	<div class="left">&nbsp;</div>
	<input type="submit" value="提交" id="phpok_submt" name="phpok_submit" class="btn2">
</div>
</form>

<script type="text/javascript">
function chk()
{
	var filename = getid("tplfile").value;
	if(!filename)
	{
		alert("模板名不能为空");
		return false;
	}
	//通过服务端检测文件是否重名
	var url = "{:site_url('tpl,ajax_chk')}id={:$id}&parent={:$parent}&filename={:$tplfile}&tplfile="+EncodeUtf8(filename);
	var msg = get_ajax(url);
	if(!msg) msg = "Error: 操作非法";
	if(msg != "ok")
	{
		alert(msg);
		return false;
	}
	//读取内容信息
	var content = $("#content").attr("value");
	if(!content)
	{
		alert("内容不允许为空");
		return false;
	}
	getid("phpok_submit").disabled = true;
}
</script>
<!-- inc:footer -->